package base

import (
	"context"
	"rewords-server-2024/internal/library/cache"

	"rewords-server-2024/api/base/cacheAPI"
)

func (c *ControllerCacheAPI) GetDataByKey(ctx context.Context, req *cacheAPI.GetDataByKeyReq) (res *cacheAPI.GetDataByKeyRes, err error) {
	//return nil, gerror.NewCode(gcode.CodeNotImplemented)
	values, err := cache.Instance().Get(ctx, req.Key)
	res = &cacheAPI.GetDataByKeyRes{
		Data: values.String(),
	}
	return res, err
}
